1. Field of the Invention
The present invention relates to a device reproducing an encoded image, a device encoding, recording and reproducing an image, a method recording/reproducing an image, and a storage medium on which is recorded a program for recording and reproducing an image.
2. Description of the Related Art
In recent years, MPEG (Moving Picture Experts Group) methods such as ISO/IEC-11172 (MPEG-1), ISO/IEC-13818 (MPEG-2), etc., have been standardized internationally, and devices for recording and reproducing MPEG streams according to these methods have been developed.
In the meantime, randomly accessible storage media such as optical, magneto-optical, and magnetic disks have been significantly increasing in capacity and dropping in price, and have been replacing magnetic tapes for recording purposes. Additionally, with randomly accessible storage media, special reproduction at an arbitrary speed-multiple, special recording/reproduction, etc., can be made.
Special reproduction of an MPEG stream such as reproduction at an arbitrary speed-multiple, etc., is implemented by seeking the start of a frame, GOP (Group Of Pictures), a packet, etc. For example, the position of a jump destination must be obtained beforehand to make a jump such as an immediate start access, etc.
For example, Japanese Patent Application No. 5-306567 discloses the technique for recording a GOP start code or the information about the presence/absence of an I picture in a subcode area of a magnetic tape.
Japanese Patent Application No. 7-298048 describes that a byte offset from the beginning of a file and the number of accumulated frames are recorded as information in an immediate start access table using a GOP start code.
Japanese Patent Application No. 7-36461 reveals that a sector address and a GOP time code are recorded as information in a special reproduction table using a GOP start code.
The size of circuitry, which is required for encoding/decoding, increases within a device recording and reproducing an image compressed in an MPEG format, even if only normal recording or reproduction is implemented, leading to a rise in device cost. To enable such a recording/reproducing device to make reproduction at an arbitrary speed-multiple, special reproduction such as clip editing, special recording, etc., the circuit size and the device cost further increase. Additionally, in special reproduction or recording, reproduction data and recorded data must be simultaneously transmitted or a transfer block size must be varied. A firmware description for controlling such a data transfer becomes complicated, so that the (overall?) cost further rises due to an increase in man-hours required for development or in control code or control circuitry size.
Furthermore, if a conventional method using a GOP start code or a GOP time code encoded in a GOP header is adopted to synchronize audio and video packets, troublesomeness of a process at the time of table generation, and an increase in DSP circuitry size become problematic.
It is necessary that the information used for special reproduction is not dependent on a storage medium or a frame rate. Especially, digital information like an MPEG stream is equally handled by a recording/reproducing device and a personal computer. Therefore, data must be moved or copied between storage media in different formats, for example, from a magnetic disk to an optical disk. Furthermore, MPEG streams are widely used in growing networks. Information of an MPEG stream must be made available with both of NTSC and PAL methods implementing different frame rates.
The above described invention of Japanese Patent Application No. 5-306567 is tailored to a magnetic tape, and not implemented as a list or a table. Additionally, this invention is not intended to make special reproduction based on a random access in nature.
According to the invention of Japanese Patent Application No. 7-298048, recorded information is frames. Considering the case where an immediate start access is made by specifying a seek destination with time, use of a single frame rate is assumed. Therefore, MPEG streams with different frame rates cannot be handled.
According to the invention of Japanese Patent Application No. 7-36461, a GOP time code is recorded. Therefore, this invention can cope with the case where an immediate start access is made by specifying a seek destination with time. However, since information is described in sectors, there is a disadvantage that a table must be again generated when a storage medium is changed.
To efficiently make special reproduction or special recording/reproduction, a data position required to directly access the data must easily be obtained from the time information specified by an application or a user.
As its method, a data position may be obtained with a GOP time code or by counting the number of frames. The former method must extract a GOP time code, and examine both of the position of the GOP start code and that of the packet including the code in an MPEG stream. Therefore, this method is inefficient. The latter method requires a process for counting the number of frames, and must cope with the case where frame rates are different. Therefore, also this method is inefficient.
When special reproduction is made, a data transfer speed does not become constant. Accordingly, there is a need to address this problem. Additionally, when special reproduction is made in combination with recording, its process becomes complicated due to the complexity of data traffic within the system.
Furthermore, for a storage medium such as an optical disk, a magneto-optical disk, or a magnetic disk, a read or a write operation is sometimes disabled for several seconds, when a fault is detected in internal parameter adjustment or a storage area, and data is written to another area. If such a phenomenon occurs during a DMA transfer at a read or a write operation, data is lost during recording, and video is suspended during reproduction.
An object of the present invention is to allow special reproduction such as reproduction at an arbitrary speed-multiple, etc., and special recording/reproduction to be easily made in an image reproducing device reproducing encoded image data. Another object of the present invention is to allow recording, reproduction and a data transfer to be efficiently made.
FIG. 1A explains the principle of the invention whereas FIG. 1B explains the principle of the invention, which further comprises packet information generating unit.
The invention comprises packet information referencing unit 1 for referencing packet information composed of a time stamp included in a packet header of encoded image data and information pointing to the packet header, and decoding unit 2 for decoding an encoded image based on the packet information referenced by the packet information referencing unit 1.
According to this invention, an arbitrary reproduction point can easily be obtained by referencing packet information composed of a time stamp included in a packet header and information pointing to the packet header.
The invention may further comprise packet information generating unit 3 for generating packet information composed of a time stamp included in a packet header of encoded image data, and information pointing to the packet header.
According to this invention, packet information of image data encoded by a different device can be generated by the packet information generating unit 3, whereby an arbitrary reproduction point can be obtained based on the packet information.
For example, if encoded image data is an MPEG stream, packet information composed of PTS (Presentation Time Stamp) included in a packet header of the MPEG stream, and a file address of the packet header is generated, and a packet information list is further generated.
PTS of a video packet in an MPEG stream is added in correspondence with all of picture start codes, while PTS of an audio packet is added to all of packets. A time stamp such as PTS obtained from an MPEG stream, STC (System Time Clock) obtained by decoding unit 2, and the like are information common to all of streams counted by a 90-kHz counter for MPEG-1. Accordingly, time information that is not dependent on a frame rate can be obtained by using the PTS.
By way of example, if a reproduction point is specified with a time from the first packet of image data, the time is converted into a time stamp (TS), and packet information having a value close to that of the time stamp (TS) is searched from a packet information list, so that the file address of the corresponding packet can be obtained, and special reproduction such as special reproduction at an arbitrary speed-multiple or special recording/reproduction can easily be implemented.
Furthermore, encoding unit for encoding an image and for recording the encoded image on an external or internal storage medium may be comprised.
According to this invention, packet information composed of a time stamp in a packet header of encoded image data and information pointing to the packet header can be generated, when an image is encoded and recorded. As a result, special reproduction such as forward and backward image reproduction at an arbitrary speed-multiple, a random access, etc., and special recording such as live monitoring, real-time shift, etc. can be implemented without expanding hardware, and without making recording and reproduction processes complicated.
Furthermore, an image encoding process performed by the encoding unit, a recorded data transfer process for transferring encoded image data to the recording unit, a reproduction data transfer process for transferring image data recorded on the recording unit to the decoding unit 2, and an image data decoding process performed by the decoding unit 2 may be implemented as multiple tasks.
In this case, the descriptions of the transfer processes can be simplified by defining a recording data transfer task and a reproduction data transfer task as different tasks.
Additionally, by individually setting a transfer data block size for each data transfer task, a data transfer at the time of special reproduction and special recording/reproduction can be made efficient.
Furthermore, the priority of the recorded data transfer task may be assigned higher than that of the reproduction data transfer task.
By assigning a higher priority to the recording data transfer task, data to be recorded can be prevented from being lost.
According to one preferred embodiment of the present invention, address information (file pointer) of a packet header is used as a data position, and PTS included in the packet header is used as time information. Since PTS is attached to a packet by encoding unit when data is encoded in an MPEG format, packet information generating unit can easily generate a special reproduction list by using the PTS without particularly generating data for special reproduction. Additionally, because the encoding unit uses a GOP start code when extracting a packet header of a packet including a GOP header, information of a packet including a GOP start code can also be obtained with ease.